<template>
  <el-form :model="formInline" class="form-inline">
    <el-row class="row">
      <el-form-item label="队伍名称：">
        <el-input
          v-model="formInline.teamName"
          placeholder="--请输入--"
        ></el-input>
      </el-form-item>
      <el-form-item label="主要装备：">
        <el-input
          v-model="formInline.mainEquipment"
          placeholder="--请输入--"
        ></el-input>
      </el-form-item>
      <el-form-item class="btns">
        <el-button type="primary" @click="onSubmit">查询</el-button>
        <el-button type="success" @click="onClear">清空</el-button>
      </el-form-item>
    </el-row>
  </el-form>
</template>

<script setup>
import { reactive, defineEmits } from 'vue'

const formInline = reactive({
  mainEquipment: '',
  teamName: ''
})

const emits = defineEmits(['onSearch'])

const onSubmit = () => {
  emits('onSearch', formInline)
}
const onClear = () => {
  formInline.mainEquipment = ''
  formInline.teamName = ''
  emits('onSearch', formInline)
}
</script>

<style lang="scss" scoped>
.form-inline {
  width: 100%;
  position: relative;
  .row {
    display: flex;
    column-gap: 5%;
  }
  .btns {
    position: absolute;
    right: 0;
    top: 1px;
    .m-left {
      margin-left: 20px;
    }
  }
}
</style>
